Skip to main content

Example

We have a single message containing multiple furnace readings, and we need to split them into individual messages for further processing.

{
"furnace": {
"temp": 86,
"humidity": 64,
"pressure": 80
}
}

What Node to be Used?

In this example, we use the split node to break one message into multiple smaller messages.

ParameterDescription
Name Optional label for the node to help identify it in the flow.
Split the The property of the message to split, usually msg.payload, but can be any property such as msg.payload.data.
String / Buffer - Split using For string or buffer payloads, specifies how to split:
string: Use a specific string or regular expression pattern to split the message.
buffer: Defines chunk size by which the message is split.
Fixed length of: Split the string according to the set length.
• Leave empty to return the tring unsplit.
Handle as a stream of messages When checked, the node will process incoming data as a continuous stream, emitting split messages as data arrives, rather than waiting for the full payload.
Array - Split using Fixed length of N: Splits the array into multiple messages with N elements each.
Object - Send a message for each key/value pairThe value of each key/value pair will be returned as payload.
Copy key to msg.payload If checked, the original key will be returned as msg.payload of the split messages.

How to Split Messages?

  1. In EventFlow, drag in an inject node, and use a function node to transmit the object.
  1. Connect it to 2 split nodes in order, and configure both properties as the same on the Object part.
  1. Connect the split node to a debug node to inspect each individual output message.